import { MyPick, MyReadonly, MyTupleToObject } from './src/index';

// -----------实现 Pick----------------------------------------------
interface PickExample {
  title: string;
  complete: boolean;
  name: string;
}

type PickUse = MyPick<PickExample, 'title' | 'complete'>;

const pickObj: PickUse = {
  title: '233',
  complete: true,
};

pickObj;

// -----------实现 Readonly ----------------------------------------------

interface ReadonlyExample {
  title: string;
  age: number;
}
type ReadonlyUse2 = MyReadonly<ReadonlyExample>;
const readonlyObj2: ReadonlyUse2 = {
  age: 23,
  title: 'cqc',
};
readonlyObj2.age;

// -----------元组转换为对象 ----------------------------------------------
const tuple = ['tesla', 'model3', 'modelX', 'modelY'] as const;
type MyTupleToObjectUse = MyTupleToObject<typeof tuple>;

const myTupleToObject: MyTupleToObjectUse = {
  model3: 'model3',
  modelX: 'modelX',
  modelY: 'modelY',
  tesla: 'tesla',
};
myTupleToObject;
